

{% extends 'admin/admin_nav.html' %}
{% block head %}
    <title>TheOne新闻社后台管理</title>
{% endblock %}
{% block content %}
    <!-- 消息闪现 -->
    {% for msg in get_flashed_messages() %}
        <p class="bg-success">{{ msg }}</p>
    {% endfor %}

    <!-- 表格，存放新闻具体内容 -->
    <table class="table table-hover">

        <tr class="info">
            <th>编号</th>
            <th>新闻标题</th>
            <th>类别</th>
            <th>作者</th>
            <th>添加时间</th>
            <th>操作</th>
        </tr>
        {% for new_obj in news_list.items %}
            <tr class="active">
                <td>{{ new_obj.id }}</td>
                <td>{{ new_obj.title }}</td>
                <td>{{ new_obj.types }}</td>
                <td>{{ new_obj.author }}</td>
                <td>{{ new_obj.created_at }}</td>
                <td>
                    <a href='/admin/update/{{ new_obj.id }}/' class='btn btn-info'>修改</a>
                    <a href='{{ url_for('admin_delete', pk=new_obj.id) }}'
                       class='btn btn-danger'>删除</a></td>
            </tr>
        {% endfor %}
    </table>

    <!-- 分页，默认分页 -->
    <nav aria-label="Page navigation">
        <ul class="pagination">
                <li>
                    {% if news_list.has_prev %}
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    {% else %}
                    {% endif %}
                </li>
                {% for page in news_list.iter_pages() %}
                    <li>
                        <a href="{{ url_for('admin', page=page) }}">{{ page }}</a>
                    </li>
                {% endfor %}

                <li>
                    {% if news_list.has_next %}
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    {% endif %}
                </li>
                </ul>

    </nav>

    </div>
    </div>
{% endblock %}

</body>
</html>

